package com.hsgene.order.persistence;

import com.hsgene.order.condition.OrderSupplierCondition;
import com.hsgene.order.domain.OrderSupplier;
import com.hsgene.order.dto.OrderSupplierInvoiceDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 机构订单Repository
 *
 * @author wangbing
 * @version 1.0, 2018/8/3
 */
@Repository
public interface OrderSupplierRepository {

    /**
     * 保存供应商订单
     *
     * @param orders 供应商订单列表
     */
    void saveBatch(@Param("orders") List<OrderSupplier> orders);

    /**
     * 供应商订单总数
     *
     * @param condition
     * @return
     */
    int queryOrderSupplierCount(@Param("condition") OrderSupplierCondition condition);

    /**
     * 查询供应商列表
     *
     * @param condition
     * @return
     */
    List<OrderSupplier> queryOrderSupplier(@Param("condition") OrderSupplierCondition condition);

    /**
     * 根据id查找信息
     *
     * @param id
     * @return
     */
    OrderSupplier getById(String id);

    /**
     * 更新订单状态
     *
     * @param orderSupplier(状态和主键)
     * @return
     */
    int updateStatus(@Param("orderSupplier") OrderSupplier orderSupplier);

    /**
     * 插入发票
     *
     * @param orderSupplierInvoiceDto
     * @return
     */
    int insertInvoice(OrderSupplierInvoiceDto orderSupplierInvoiceDto);

    /**
     * 订单表插入发票ids
     *
     * @param split
     * @return
     */
    int insertOrderRelayIds(Map<String, Object> split);

    /**
     * 根据主键查找发票
     *
     * @param invoiceId
     * @return
     */
    OrderSupplierInvoiceDto getInvoiceByPermaryKey(Integer invoiceId);

    /**
     * 更新报告信息
     *
     * @param orderSupplier
     * @return
     */
    int updateReportSupplie(OrderSupplier orderSupplier);
}
